package com.multition.demo02;

import java.text.NumberFormat;
import java.util.Locale;

/**
 * TODO java.text.NumberFormat 类提供了对数字格式的支持
 */
public class NumberFormatTest {
    public static void main(String[] args) {
        displayNumber(new Double(1234567.89), new Locale("en", "US"));
        displayNumber(new Double(1234567.89), new Locale("de", "DE"));
        displayNumber(new Double(1234567.89), new Locale("fr", "FR"));
    }

    static public void displayNumber(Double amount, Locale currentLocale) {

        NumberFormat formatter;
        String amountOut;

        formatter = NumberFormat.getNumberInstance(currentLocale);
        amountOut = formatter.format(amount);

        System.out.println(amountOut + "   " + currentLocale.toString());
    }
}
